<template>
    <div>
        <div @click="xxx">新华书城</div>
        <slider :books=" announcement" :slides="slides">
        </slider>
        <booklist :books="lastupdatebooks"
                  heading="最新更新"
                  @haha="xxx"></booklist>
        <booklist :books="recommended"
                  heading="编辑推荐"
                  @haha="xxx"></booklist>


    </div>

</template>
<script type="text/ecmascript-6">
    import  slider from './slider.vue'
    import booklist from './booklist.vue'

    export default{
        components:{slider,booklist}   ,

        data() {
            return {
//                books: [{img_url: require("./fixtures/covers/1.svg"), title: '揭开数据真相', authors: ['tim', 'liu']}
//                    , {img_url: require("./fixtures/covers/2.svg"), title: 'Android高级进阶', authors: ['大漠穷秋']}
//                    , {img_url: require("./fixtures/covers/3.svg"), title: '淘宝天猫运营', authors: ['唐晓君', '林子雨', '黄振虎']}
//                ],
//                announcement: '本周新书优惠,新上架电子书一律8折',
//                slides: [{img_url: require('./fixtures/sliders/t1.svg')}
//                    , {img_url: require('./fixtures/sliders/t2.svg')}],
//            }
//        },

        slides: [],
                recommended:[],
                announcement:'',
                lastupdatebooks: []
    }
    },
    created(){
        this.$http.get('/src/data.json').then(res=>
        {
            console.log(res);
            this.lastupdatebooks=res.body.lastupdatebooks;
            this.announcement=res.body.announcement;
            this.recommended=res.body. recommended;
            this.slides=res.body.slides;
        })
    },
        methods:{
            xxx(){
                window.alert('hahaha');
            }
        }
    }
</script>